/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package library;

/**
 *
 * @author TECHNOLOGIES
 */
public class FrameLibraryModule extends javax.swing.JFrame {

    /**
     * Creates new form FrameLibraryModule
     */
    public FrameLibraryModule() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        collegeaccountantPUEntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("collegeaccountantPU").createEntityManager();
        libraryQuery = java.beans.Beans.isDesignTime() ? null : collegeaccountantPUEntityManager.createQuery("SELECT l FROM Library l");
        libraryList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : libraryQuery.getResultList();
        labelLibraryModule = new javax.swing.JLabel();
        scrollPaneLibrary = new javax.swing.JScrollPane();
        tableLibrary = new javax.swing.JTable();
        labelLibraryBG = new javax.swing.JLabel();

        setTitle("Library Module  - College Accountant");
        getContentPane().setLayout(null);

        labelLibraryModule.setFont(new java.awt.Font("Courier New", 1, 24)); // NOI18N
        labelLibraryModule.setForeground(new java.awt.Color(255, 255, 255));
        labelLibraryModule.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        labelLibraryModule.setText("Library Module ");
        getContentPane().add(labelLibraryModule);
        labelLibraryModule.setBounds(590, 10, 300, 40);

        tableLibrary.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_NEXT_COLUMN);
        tableLibrary.setSurrendersFocusOnKeystroke(true);

        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, libraryList, tableLibrary);
        org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${qty}"));
        columnBinding.setColumnName("Qty");
        columnBinding.setColumnClass(Integer.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${costPerPrice}"));
        columnBinding.setColumnName("Cost Per Price");
        columnBinding.setColumnClass(Float.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${vendor}"));
        columnBinding.setColumnName("Vendor");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${bookMagazineOrdered}"));
        columnBinding.setColumnName("Book Magazine Ordered");
        columnBinding.setColumnClass(Integer.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${librarianID}"));
        columnBinding.setColumnName("Librarian ID");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${fine}"));
        columnBinding.setColumnName("Fine");
        columnBinding.setColumnClass(Float.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${registrationFee}"));
        columnBinding.setColumnName("Registration Fee");
        columnBinding.setColumnClass(Float.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${studentID}"));
        columnBinding.setColumnName("Student ID");
        columnBinding.setColumnClass(String.class);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        scrollPaneLibrary.setViewportView(tableLibrary);

        getContentPane().add(scrollPaneLibrary);
        scrollPaneLibrary.setBounds(0, 64, 1250, 290);

        labelLibraryBG.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/loginbg.jpg"))); // NOI18N
        getContentPane().add(labelLibraryBG);
        labelLibraryBG.setBounds(0, 0, 1610, 850);

        bindingGroup.bind();

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FrameLibraryModule.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FrameLibraryModule.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FrameLibraryModule.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FrameLibraryModule.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                FrameLibraryModule frameLibraryModule =  new FrameLibraryModule();
                frameLibraryModule.setExtendedState(FrameLibraryModule.MAXIMIZED_BOTH);
                frameLibraryModule.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.persistence.EntityManager collegeaccountantPUEntityManager;
    private javax.swing.JLabel labelLibraryBG;
    private javax.swing.JLabel labelLibraryModule;
    private java.util.List<library.Library> libraryList;
    private javax.persistence.Query libraryQuery;
    private javax.swing.JScrollPane scrollPaneLibrary;
    private javax.swing.JTable tableLibrary;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
}
